package interfaces.spawnMenu;

import logic.common.team.Team;
import logic.ships.hunter.Hunter;

import fileHandling.language.Lang;

import interfaces.language.LanguageWindow;

public abstract class SpawnMenuWindow extends LanguageWindow {
	
	protected Team team, enemyTeam;
	protected Hunter hunter;
	protected AbsSpawnMenu spawnMenu;
	
	public SpawnMenuWindow(Lang title, Team team, Team enemyTeam, AbsSpawnMenu spawnMenu) {
		this(title, team, enemyTeam, spawnMenu, true);
	}
	
	public SpawnMenuWindow(Lang title, Team team, Team enemyTeam, AbsSpawnMenu spawnMenu, boolean closeButton) {
		super(closeButton, title);
		this.team = team;
		this.enemyTeam = enemyTeam;
		this.spawnMenu = spawnMenu;
		
		SelectWindow selectWindow = spawnMenu.getSelectWindow();
		
		int border = selectWindow.getY();
		int height = spawnMenu.getHeight() - (border * 2);
		int width = selectWindow.getX() - (border * 2);
		
		setSize(width, height);
		setXY(border, border);
	}
	
	public void changeTeam(Team team) {
		enemyTeam = this.team;
		this.team = team;
		content.removeAllWidgets();
	}
	
	public Team getTeam() { return team ; }
	
	@Override
	public void close() {
		super.close();
		spawnMenu.removeWidget(this);
	}
	
	public void changeHunter(Hunter hunter) {
		this.hunter = hunter;
		content.removeAllWidgets();
	}
}